;switch(thread_tcb from,thread_tcb to)
global switch_to
[bits 32]
section .text
switch_to:
;first we save the from thread context
	push esi
	push edi
	push ebx
	push ebp
	;eax point to from thread tcb
	mov eax,[esp+20]
	;save current thread stack in the kstack
	mov [eax],esp
;then we restore the to thread context
	mov eax,[esp+24]
	mov esp,[eax]
	pop ebp
	pop ebx
	pop edi
	pop esi
;here the stack is point to the to thread last ret address
	ret
